/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.server.modules.sys.service.material;

import com.server.common.service.TreeService;
import com.server.common.utils.StringUtils;
import com.server.modules.sys.dao.material.MaterialTypeDao;
import com.server.modules.sys.entity.material.MaterialType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 资料属性类别表Service
 * @author 王磊
 * @version 2016-09-12
 */
@Service
@Transactional(readOnly = true)
public class MaterialTypeService extends TreeService<MaterialTypeDao, MaterialType> {

	public MaterialType get(String id) {
		return super.get(id);
	}
	
	public List<MaterialType> findList(MaterialType materialType) {
		if (StringUtils.isNotBlank(materialType.getParentIds())){
			materialType.setParentIds(","+materialType.getParentIds()+",");
		}
		return super.findList(materialType);
	}
	
	@Transactional(readOnly = false)
	public void save(MaterialType materialType) {
		super.save(materialType);
	}
	
	@Transactional(readOnly = false)
	public void delete(MaterialType materialType) {
		super.delete(materialType);
	}
	
}